﻿@{
    // Set the layout page and page title
    LayoutPage = "~/_SiteLayout.cshtml";
    PageData["Title"] = "Registration Confirmation Page";

    string message = "";
    var confirmationToken = Request["confirmationCode"];
    
    if (!WebSecurity.IsAuthenticated) {
        if (!confirmationToken.IsEmpty()) {
            if (WebSecurity.ConfirmAccount(confirmationToken)) {
                message = "Registration Confirmed! Click on the Login tab to log in to the site.";
            }
            else {
                message = "Could not confirm your registration info";
            }
        }
    }
    else {
        message = "It appears that you've already confirmed your account and are logged in. Please enjoy the site.";
    }
}

@if (!@message.IsEmpty()) {
    <p>@message</p>
} else {
    <form method="post" action="">
        <fieldset>
            <legend>Confirmation Code</legend>
            <p>
                Please enter the confirmation code sent to you via email and 
                then click the <em>Confirm</em> button.
            </p>
            
            <input type="text" name="confirmationCode" />
            <input type="submit" value="Confirm" />
        </fieldset>
    </form>
}